header imaths
{
	// The following script shows the built in global maths functions
	// By Mauro Grassi...

	// Override the default behaviour, we want it to run only once...
	execMode=#execModeNoRestart;

}

script imaths
{
	$B[100]=0;
	$A=1;
	$counter=0;
	print "The following numbers from 1 to 100 are primes: ", newline;
	while($A<=100)
	{
		if(@@isPrime($A))
		{
			// store the prime number...
			$B[$counter]=$A;
			if(($counter % 8)==0)
			{
				print $A;
			}
			else
			if(($counter % 8)==7)
			{
				print ", ", $A, newline;	
			}
			else
			{
				print ", ", $A;
			}
			$counter=$counter+1;
		}	
		$A=$A+1;
	}

	$A=0;
	while($A<$counter)
	{
		print $A, ": ", $B[$A], newline;
		$A=$A+1;
	}
	print newline, "There were exactly ", $counter, " primes found.", newline;
	print "Their sum is: ", @@sum(&$B, $counter), newline;
}
